// src/router/index.js
import Vue from 'vue';
import Router from 'vue-router';
import Home from "@/components/Home.vue";

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            component: Home,
            name: 'Home'
        },
        {
            path: '/login',
            name: 'UserLogin',
            component: () => import('@/components/UserLogin.vue')
        },
        {
            path: '/register',
            name: 'UserRegister',
            component: () => import('@/components/UserRegister.vue')
        },
        {
            path: '/adminlogin',
            name: 'AdminLogin',
            component: () => import('@/components/AdminLogin.vue')
        },
        {
            path: '/admin',
            component: () => import('@/components/Layout/AdminLayout.vue'),
            name: 'Admin',
            children: [
                {
                    path: 'dashboard',
                    name: 'AdminDashboard',
                    component: () => import('@/components/AdminView/AdminDashboard.vue')
                },
                {
                    path: 'products',
                    name: 'AdminProducts',
                    component: () => import('@/components/AdminView/AdminProducts.vue')
                },
                {
                    path: 'orders',
                    name: 'AdminOrders',
                    component: () => import('@/components/AdminView/AdminOrders.vue')
                },
                {
                    path: 'organization',
                    name: 'AdminOrganization',
                    component: () => import('@/components/AdminView/AdminOrganization.vue')
                },
                {
                    path: 'store',
                    name: 'AdminStore',
                    component: () => import('@/components/AdminView/AdminStore.vue')
                },
                {
                    path: 'staff',
                    name: 'AdminStaff',
                    component: () => import('@/components/AdminView/AdminStaff.vue')
                },
                {
                    path: 'refunds',
                    name: 'AdminRefunds',
                    component: () => import('@/components/AdminView/AdminRefunds.vue')
                },
                {
                    path: 'admins',
                    name: 'AdminAdmins',
                    component: () => import('@/components/AdminView/AdminAdmins.vue')
                },
                {
                    path: 'permission',
                    name: 'AdminPermission',
                    component: () => import('@/components/AdminView/AdminPermission.vue')
                },
            ]
        },
        {
            path: '/shop',
            component: () => import('@/components/Layout/ShopLayout.vue'),
            name: 'Shop',
            children: [
                {
                    path: 'products/:productType',
                    name: 'ShopProducts',
                    component: () => import('@/components/ShopView/ShopProducts.vue')
                },
                {
                    path: 'home',
                    name: 'ShopMain',
                    component: () => import('@/components/ShopView/ShopComponents/ShopMain.vue')
                },
                {
                    path: '/shopinfo',
                    name: 'ShopInfo',
                    component: () => import('@/components/ShopView/ShopInfoDetail.vue')
                }
            ]
        },
        {
            path: '/shopProfile',
            name: 'ShopProfile',
            component: () => import('@/components/ShopView/ShopProfile.vue')
        },
        {
            path: '/shopCart',
            name: 'ShopCart',
            component: () => import('@/components/ShopView/ShopCart.vue')
        },
        {
            path: '/shopOrder',
            name: 'ShopOrder',
            component: () => import('@/components/ShopView/ShopOrder.vue')
        },
        {
            path: '/shopOrderDetail',
            name: 'ShopOrderDetail',
            component: () => import('@/components/ShopView/ShopOrderDetail.vue')
        },
        {
          path:'/shopOrderDetails',
          name:'ShopOrderDetails',
          component:() => import('@/components/ShopView/ShopOrderDetail.vue')
        }


    ]
});

/**
 * 可能要添加全局守卫
 */
